//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    sarineNumber: ''
  },
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  handleScan: function(){
    wx.scanCode({
      success: (res) => {
        console.log(res)
      }
    })
  },
  handleSearch: function(){
    if (this.data.sarineNumber.length == 10) {
      this.data.sarineNumber = this.data.sarineNumber.toLocaleUpperCase()
      wx.navigateTo({
        url: '/pages/result/result?sarineNumber=' + this.data.sarineNumber
      })
    }else {
      wx.showModal({
        title: "请输入正确的证书编号",
        showCancel: false
      })
    }
  },
  getSarineNumber: function(e){
    var val = e.detail.value;
    this.setData({  
      sarineNumber: val  
    });
  }
})
